#include <sstream>

#include "exceptions.h"

MemoryException::MemoryException (uint16_t address)
{
  _address = address;
}

const char* MemoryException::what () const throw ()
{
  ostringstream out;
  out << "Invalid memory request at 0x" << hex << _address;
  return out.str ().c_str ();
}



const char* SpecException::what () const throw ()
{
  return "Invalid specification";
}



CoreException::CoreException (uint16_t address, uint16_t op)
{
  _address = address;
  _op = op;
}

const char* CoreException::what () const throw ()
{
  ostringstream out;
  out << "Core exception, op: " << _op << " address: " << _address;
  return out.str ().c_str ();
}



const char* IndexException::what () const throw ()
{
  return "An index was out of range";
}
